home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SIGGRAPH 1997: Visual Proceedings
/
SIGGRAPH 1997: Visual Proceedings - Disc 2.iso
/
pc
/
contents
/
sketches
/
technic
/
ibrahim
/
abstract.txt
< prev
next >
Wrap
Text File
|
1997-07-05
|
5KB
|
113 lines
Genetic Shaders: Interactive and Automatic Shader Generation
Aladin M. Ibrahim and Donald H. House
Visualization Laboratory
216 Langford Center
Texas A&M University
College Station, TX 77843
(409)845-3465
(409)845-4491 (Fax)
aladin@viz.tamu.edu
house@viz.tamu.edu
Contact author:
Aladin M. Ibrahim
Genetic Shaders: Interactive and Automatic Shader Generation
Summary
This sketch presents a system that generates procedural textures or
shaders using genetic algorithm techniques. The system operates in
both artist directed and automatic texture matching modes.
Genetic Shaders: Interactive and Automatic Shader Generation
Introduction
Realistic image generation in computer graphics is greatly facilitated
by either using texture mapping of real images or writing shaders,
programs that procedurally describe textures. Using texture mapping,
e.g. scanning a photograph, is rarely adequate as the photograph may
capture information about the lighting direction and may cause
aliasing problems. Another problem with a scanned texture image is
that it has a finite size and resolution, and tiling the texture
across a surface may cause unnatural periodicity. Writing shaders
might seem to be a powerful approach, however in practice it is often
very difficult to achieve desired look.
This sketch presents a system that generates procedural textures or
shaders using genetic algorithm techniques. The system operates in
both artist directed and automatic texture matching modes. In
interactive artist directed mode, aesthetic evaluation and selection
is controlled by the user. In automatic mode, the system compares
rendered images of generated shaders to images of target textures,
using texture matching techniques.
Representation
In our system, a shader is a hierarchical directed acylic graph of
nodes, where each node represents a predefined function or texture.
Initial Selection
An initial population of shaders is obtained by searching through a
predefined library of shaders, testing these images from the shaders
against the target texture and scoring the images. The system selects
the initial population from those receiving the best scores. Selection
in the interactive mode is similar but based on the users' aesthetic
judgment.
Breeding and Ongoing Evaluation
"Parent" shaders are selected and bred to create new children for the
ongoing population. When breeding two hierarchies of shaders, the
breeding procedure selects a random node in each hierarchy and swaps
the subtrees under these nodes. The system evaluates images of
generated shaders in the automatic mode, while in interactive mode
users assign scores to images of shaders based on their aesthetic
judgment.
The new population of shaders is determined based on this fitness
evaluation. A genetic algorithm procedure is used to determine which
shaders will survive and reproduce and which will die, based on this
fitness. Shaders are shuffled and each pair of shaders is selected to
breed. After a new population is generated, using the interactive
mode, users repeat previous steps to generate a new population and so
on until satisfied with the result. In the automatic mode, the
generation continues until a generated shader is sufficiently close to
the target texture or a maximum number of generations has been
reached.
Mutation
Random mutation is used to introduce diversity into the
population. After breeding, the hierarchy is traversed, leaf node
input variables are randomly selected, and depending on the mutation
rate, changed to other valid values.
User Interface and Operation
The figure accompanying this text shows the system as it appears to the
user, and a collection of generated shaders. The top row of the
interface contains generation parameters while the middle three rows
contain rendered images of the current population of shaders. On the
bottom row are images of temporarily stored shaders.
The interactive mode has been used to generate a variety of complex
shaders including both surface and displacement shaders, such as those
shown in the figure. When running in interactive mode, the user
selects two parents for breeding and the top two images on the
interface show the currently selected parents. On the other hand, in
automatic mode, the top two images show the target texture, and the
middle three rows show images of shaders that are attempts to match
the target shader. In this case, parent selection and breeding takes
place automatically.